package com.itheima.day07_Collection;

import java.util.Comparator;
import java.util.Random;
import java.util.TreeSet;

public class TreeSetTest {
    public static void main(String[] args) {
        TreeSet<Integer> integers1 = new TreeSet<>((o1, o2) -> o1 - o2);
        Random r = new Random();
        for (int i = 0; i < 10; i++) {
            integers1.add(r.nextInt(0, 51));
        }
        System.out.println(integers1);

        TreeSet<Integer> integers2 = new TreeSet<>((o1, o2) -> o2 - o1);
        for (int i = 0; i < 10; i++) {
            integers2.add(r.nextInt(50, 101));
        }
        System.out.println(integers2);
    }
}
